
<html lang="en">
<head>
    @include('Admin.header')
    <style>
    </style>
</head>
<body>
<div class="wrapper layui-container">
    <div class="page-content layui-row ">
        <div class="content layui-col-xs11 layui-col-xs-offset1">
            <form class="layui-form" id="form">
                <div class="layui-form-item">
                    <label for="module_name" class="layui-form-label">
                        <span class="x-red"> * </span>模块名称
                    </label>
                    <div class="layui-input-inline">
                        <input type="text" id="module_name" name="module_name" required="" lay-verify="required"
                               autocomplete="off" class="layui-input" value="{{$vo->name}}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="sort" class="layui-form-label">
                        <span class="x-red">  </span>排序
                    </label>
                    <div class="layui-input-inline">
                        <input type="text" id="sort" name="sort"
                               autocomplete="off" class="layui-input" placeholder="0" value="{{$vo->sort}}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="icon" class="layui-form-label">
                        <span class="x-red"> * </span>图标
                    </label>
                    <div class="layui-input-inline">
                        <input type="text" id="icon" name="icon"
                               autocomplete="off" class="layui-input" lay-verify="required" value="{{htmlspecialchars($vo->icon)}}">
                    </div>
                </div>
                <div class="layui-form-item" style="margin-left:35px;">
                    图标库：<a href="http://www.layui.com/doc/element/icon.html" target="_blank">http://www.layui.com/doc/element/icon.html</a>
                </div>
                {{ csrf_field() }}
                <div class="layui-form-item">
                    <label for="" class="layui-form-label">
                    </label>
                    <input type="hidden" name="id">
                    <button  class="layui-btn" lay-filter="add" lay-submit>
                        修改
                    </button>
                    <button  class="layui-btn" onclick="parent.layer.closeAll();" style="margin-left:50px;background-color:#778899">
                        取消
                    </button>
                </div>
            </form>
        </div>
    </div>
</div>
<script>

    layui.use('form', function(){
        var form = layui.form;
        //监听提交
        form.on('submit(add)', function(data){
            $.ajax({
                dataType:'json',
                type: 'post',
                url: '{{url("Admin/System/module/edit/do")}}',
                data: $('#form').serialize(),
                success: function(data){
                    if(1 == data){
                        layer.msg('修改成功!', {
                            icon: 1,
                            time: 2000 //2秒关闭（如果不配置，默认是3秒）
                        }, function(){
                            parent.layer.closeAll();
                        });
                    }else{
                        layer.msg('修改失败!');
                    }
                }
            });
            return false;
        });
    });
</script>
</body>
</html>